package com.abbas.myviewtest.view.model;

/**
 * @author abbas
 * @description: TODO
 * @date 2022/3/29 19:36
 */
public class Position {

    private int row; //行
    private int column; //列

    private int x; //x坐标
    private int y; //y坐标

    public Position(int row, int column) {
        this.row = row;
        this.column = column;
    }

    public Position(int row, int column, int x, int y) {
        this.row = row;
        this.column = column;
        this.x = x;
        this.y = y;
    }

    public Position(Position position) {
        this(position.row,position.column,position.x,position.y);
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getRow() {
        return row;
    }

    public int getColumn() {
        return column;
    }

    public boolean moveToNextPosition(){
        if (x < row - 1){
            x++;
        }else if (y < column - 1){
            y++;
            x = 0;
        }else return false;

        return true;
    }
}
